<template>
    <n-modal
        style="width: 57%"
        :show="show"
        :mask-closable="maskClosable"
        :transform-origin="transformOrigin"
        @update:show="modalUpdateShowHandler"
    >
        <n-card>
            <login-tabs
                @login-success="loginSuccessHandler"
                @register-success="registerSuccessHandler"
            />
        </n-card>
    </n-modal>
</template>

<script lang="ts" setup>
defineOptions({ name: 'LoginModal' });
defineProps<{
    show?: boolean;
    maskClosable?: boolean;
    transformOrigin?: 'mouse' | 'center';
}>();
const emits = defineEmits(['update', 'loginSuccess', 'registerSuccess']);

/** modal update show 操作 */
async function modalUpdateShowHandler(val: boolean) {
    emits('update', val);
}

/** 登录成功回调 */
async function loginSuccessHandler(val: any) {
    emits('loginSuccess', val);
}

/** 注册成功回调 */
async function registerSuccessHandler(val: any) {
    emits('registerSuccess', val);
}
</script>
